﻿using System;

using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace BFTest.Particles
{
    class CParticleFire : CParticle
    {
        // TODO: Move this to the LoadContent method.
        Texture2D texture = BFTestGame.Battlefield.GlowTexture;
        public override Texture2D Texture { get { return texture; } }
        Color particleColor = Color.Orange;
        public override Color ParticleColor { get { return particleColor; } set { particleColor = value; } }
        public override Vector2 Size { get { return new Vector2(5, 5); } }

        static TimeSpan smokeLifeTime = TimeSpan.FromMilliseconds(250);

        public CParticleFire(Vector2 position, Vector2 velocity, TimeSpan? lifeTime, bool fadeOut = false)
            : base(position, velocity, lifeTime, fadeOut)
        {
            
        }

        protected override void Initialize()
        {
            if (BFTestGame.Battlefield.Rand.NextDouble() * 100 > 50)
                ParticleColor = Color.Blue;
            else
                ParticleColor = Color.Yellow;

            base.Initialize();
        }

        protected override void OnDeath()
        {
            BFTestGame.Particles.Add(new CParticleSmoke(Position, Vector2.Zero, smokeLifeTime, true));
        }

        public override void Update(GameTime gameTime)
        {
            base.Update(gameTime);
        }

        public override void Draw(SpriteBatch spriteBatch)
        {
            base.Draw(spriteBatch);
        }
    }
}